﻿@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section styles{
    <style>
    </style>
}

<div class="layui-card">
    <div class="layui-card-body">
        <blockquote class="layui-elem-quote layui-border-red">此操作将审核以下 @ViewBag.ContentNum 篇内容，确定吗？</blockquote>
        <table class="layui-table">
            <colgroup>
                <col width="80">
                <col>
                <col width="160">
                <col width="130">
            </colgroup>
            <thead>
                <tr>
                    <th>内容ID</th>
                    <th>内容标题</th>
                    <th>添加时间</th>
                    <th>状态</th>
                </tr>
            </thead>
            <tbody>
                @if( ViewBag.ContentList!=null){
                    foreach (var item in  ViewBag.ContentList)
                    {
                        <tr>
                            <td><input type="hidden" value="@item.Id">@item.Id</td>
                            <td>@item.Title</td>
                            <td>@item.CreateDate</td>
                            <td>
                                @if(item.Checked==1){
                                   <span class="layui-badge layui-bg-orange">草稿</span>
                                }else if (item.Checked == 2)
                                {
                                   <span class="layui-badge layui-bg-cyan">待审核</span>
                                }else if (item.Checked == 3)
                                {
                                    <span class="layui-badge layui-bg-green">已审核</span>
                                }
                                else
                                {
                                     <span class="layui-badge">终审退稿</span>
                                }
                            </td>
                        </tr>
                    }
                }
               
            </tbody>
        </table>
        <form class="layui-form" lay-filter="user-form" style="padding: 15px 0 0 0;">
            <input type="hidden" name="Ids" value="@ViewBag.Ids" />
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">审核状态</label>
                <div class="layui-input-block">
                    <select name="AuditState" lay-verify="required" >
                        @if (ViewBag.CheckedList != null)
                        {
                            foreach (var item in ViewBag.CheckedList)
                            {
                                <option value="@item.Id">@item.Title</option>
                            }
                        }
                    </select>
                    
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">审核原因</label>
                <div class="layui-input-block">
                      <textarea name="AuditRemark"  class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-hide" lay-submit lay-filter="auditcontent-submit" id="auditcontent-submit">提交</button>
                </div>
            </div>
        </form>
    </div>
</div>


@section scripts{
    <script type="text/javascript">
        layui.use(['lscom', 'form'], function () {
            var $ = layui.$;
            var lscom = layui.lscom;
            var form = layui.form;

            var index = parent.layer.getFrameIndex(window.name);
            //parent.layer.iframeAuto(index);

            window.submitForm = function () {
                $("#auditcontent-submit").click();
            }
          

            form.on('submit(auditcontent-submit)', function (data) {
                let rolecodearry = [];

                var field = data.field;
               
                var waitIndex = parent.layer.load(2);
                lscom.ajax({
                    url: "/Cms/ContentCheck/SaveData",
                    data: JSON.stringify(field),
                    lsHandleError: false
                }).done(function (data) {
                    if (data.code == 0) {
                        data.index = index;
                        let parentWindow = parent.selectedWindow().window;
                        parentWindow.saveCallback(data);
                    }
                }).fail(function (message) {
                    lscom.notify.error(message);
                }).always(function () {
                    parent.layer.close(waitIndex);
                });

                return false;
            });
        });
    </script>
  
}

